package com.pigs.springbootpigsvuecrud.service.impl;

import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pigs.springbootpigsvuecrud.entity.PgUser;
import com.pigs.springbootpigsvuecrud.mapper.PgUserMapper;
import com.pigs.springbootpigsvuecrud.service.PgUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author PIGS
 * @since 2020-05-19
 */
@Service
public class PgUserServiceImpl extends ServiceImpl<PgUserMapper, PgUser> implements PgUserService {

    @Autowired
    private PgUserMapper pgUserMapper;

    /**
     * 查询用户并分页
     *
     * @return
     */
    @Override
    public List<PgUser> queryUserList() {
        AbstractWrapper wrapper = new QueryWrapper();
        wrapper.orderByDesc("ucreatetime");
        List<PgUser> pgUsersPage = pgUserMapper.selectList(wrapper);
        return pgUsersPage;
    }
}
